package com.ruoyi.report_hntjg.mapper;

import com.ruoyi.common.core.mapper.BaseMapperPlus;
import com.ruoyi.report_hntjg.domain.ReportHntjgGjbhcjlbBsInfo;
import com.ruoyi.report_hntjg.domain.vo.ReportHntjgGjbhcjlbBsInfoVo;
import liquibase.pro.packaged.P;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 钢筋位置及保护层厚度试验检测记录Mapper接口
 *
 * @author tll
 * @date 2024-08-07
 */
public interface ReportHntjgGjbhcjlbBsInfoMapper extends BaseMapperPlus<ReportHntjgGjbhcjlbBsInfoMapper, ReportHntjgGjbhcjlbBsInfo, ReportHntjgGjbhcjlbBsInfoVo> {

    @Select("SELECT DISTINCT\n" +
        "\tinfo.gongcbwyt \n" +
        "FROM\n" +
        "\tsyrw_bs_data_report report\n" +
        "\tLEFT JOIN syrw_ref_report_excel ref ON report.report_id = ref.report_id\n" +
        "\tLEFT JOIN report_hntjg_gjbhcjlb_bs_info info ON ref.excel_id = info.excel_id \n" +
        "WHERE\n" +
        "\treport.dept_id = #{deptId} \n" +
        "\tAND ref.excel_type_id = 1821065235280064513 \n" +
        "\tAND info.gongcbwyt IS NOT NULL AND info.dunztsh IS NOT NULL \n" +
        "\tAND report.sy_type = #{syTypeId} \n" +
        "\tAND report.del_flag = 0 \n" +
        "\tAND ref.del_flag = 0 \n" +
        "\tAND info.del_flag = 0 \n" +
        "ORDER BY\n" +
        "\tinfo.gongcbwyt")
    List<String> selectGcbwList(@Param("deptId") Long deptId, @Param("syTypeId") Long syTypeId);


    @Select("SELECT \n" +
        "\tinfo.*\n" +
        "FROM\n" +
        "\tsyrw_bs_data_report report\n" +
        "\tLEFT JOIN syrw_ref_report_excel ref ON report.report_id = ref.report_id\n" +
        "\tLEFT JOIN report_hntjg_gjbhcjlb_bs_info info ON ref.excel_id = info.excel_id \n" +
        "WHERE\n" +
        "\treport.dept_id = #{deptId} \n" +
        "\tAND ref.excel_type_id = 1821065235280064513 \n" +
        "\tAND info.gongcbwyt = #{gongcbwyt} AND info.dunztsh IS NOT NULL\n" +
        "\tAND report.sy_type = 30 \n" +
        "\tAND report.del_flag = 0 \n" +
        "\tAND ref.del_flag = 0 \n" +
        "\tAND info.del_flag = 0 ")
    List<ReportHntjgGjbhcjlbBsInfoVo> tstjList(@Param("deptId") Long deptId, @Param("gongcbwyt") String gongcbwyt);
}
